ScrolledWindow: add() before remove() in snippet
authorDaniel Boles <dboles@src.gnome.org>
Sun, 7 Jan 2018 16:47:24 +0000 (16:47 +0000)
committerDaniel Boles <dboles@src.gnome.org>
Sun, 7 Jan 2018 16:47:41 +0000 (16:47 +0000)
We can't remove() a child widget that wasn't already add()ed, of course.

gtk/gtkscrolledwindow.c

index ac06f1cc105ca417ee7c32949842cb1b649a129c..2fa5ef3d07b01355706e4c0a963afc14f9eac766 100644 (file)
  * If gtk_container_add() has added a #GtkViewport for you, you can remove
  * both your added child widget from the #GtkViewport, and the #GtkViewport
  * from the GtkScrolledWindow, like this:
+ *
  * |[<!-- language="C" -->
  * GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  * GtkWidget *child_widget = gtk_button_new ();
  *
  * // GtkButton is not a GtkScrollable, so GtkScrolledWindow will automatically
  * // add a GtkViewport.
+ * gtk_container_add (GTK_CONTAINER (scrolled_window),
+ *                    child_widget);
+ *
+ * // Either of these will result in child_widget being unparented:
  * gtk_container_remove (GTK_CONTAINER (scrolled_window),
  *                       child_widget);
  * // or